package jmine.tec.batch.builder;

import java.util.HashSet;
import java.util.Set;

import jmine.tec.batch.domain.MPhase;
import jmine.tec.batch.domain.MProcess;
import bancosys.tec.persist.builders.AbstractDBBuilder;

/**
 * Builder de MProcess.
 * 
 * @author Gallardo
 */
public class MProcessBuilder extends AbstractDBBuilder<MProcess> {
    public static MProcessBuilder criaMProcess() {
        return new MProcessBuilder();
    }

    private String mnemonico = "MPROCESS_MNEMONICO";

    private String descricao;

    private Set<MPhase> phases = new HashSet<MPhase>();

    /**
     * {@inheritDoc}
     */
    @Override
    public MProcess doBuild() {
        MProcess process = this.createBean(MProcess.class);
        process.setMnemonico(this.mnemonico);
        process.setDescr(this.descricao);
        process.setPhases(this.phases);
        return process;
    }

    public MProcessBuilder comMnemonico(String mnemonico) {
        this.mnemonico = mnemonico;
        return this;
    }

    public MProcessBuilder comDescricao(String descricao) {
        this.descricao = descricao;
        return this;
    }

    public MProcessBuilder comMPhase(MPhase phase) {
        this.phases.add(phase);
        return this;
    }
}